#ifndef __WD_BLOCKQ_H
#define __WD_BLOCKQ_H
#include <func.h>
#define N 1024
typedef int E;
typedef struct {
E elements[N];
int front;
int rear;
int size;
pthread_mutex_t mutex; //互斥锁
pthread_cond_t not_empty;//子线程的条件变量 队列不为空
pthread_cond_t not_full;//主线程的条件变量 队列不满
} BlockQ;
BlockQ* blockq_create(void);
void blockq_destroy(BlockQ* q);
bool blockq_empty(BlockQ* q);
bool blockq_full(BlockQ* q);
void blockq_push(BlockQ* q, E val);
E blockq_pop(BlockQ* q);
/* E blockq_peek(BlockQ* q); */
#endif

